Avorion Script API Documentation
Alliance [Server] : Faction [Server]
This object is only available on the server.
function Alliance(var index)
Returns
A new instance of Alliance
property int leader |
property int maxNumShips | [read-only] |
property int maxNumStations | [read-only] |
property unsigned int numCrafts | [read-only] |
property int numShips | [read-only] |
property int numStations | [read-only] |
property bool alwaysAtWar |
property string baseName |
property string fullLogId | [read-only] |
property bool homeSectorUnknown |
property int index | [read-only] |
property bool infiniteResources |
property int initialRelations |
property int initialRelationsToPlayer |
property bool isAIFaction | [read-only] |
property bool isAlliance | [read-only] |
property bool isPlayer | [read-only] |
property int money |
property string name | [read-only] |
property string stateForm |
property bool staticRelationsToAI |
property bool staticRelationsToAll |
property bool staticRelationsToPlayers |
property Format unformattedName | [read-only] |
function var addKnownSector(SectorView view)
Returns
nothing
function var addRank(string name, string lowerName)
Returns
nothing
function var addRankPrivilege(string rank, int privilege)
Returns
nothing
function var addScript()
function var addScriptOnce()
function int callbacksRegistered(string callbackName, var functionName)
Check how many functions are registered to a callback from the current script VM.
Parameters
functionName The name of the function for which to check. If nil, will count all functions that are registered to this callback.
Returns
The amount of functions registered to the callback
function bool contains(int playerIndex)
function Entity createCraftFromShipInfo(string name, Matrix position, var faction)
function SectorView getKnownSector(int x, int y)
function ivec2... getKnownSectorCoordinates()
function SectorView... getKnownSectors()
function SectorView... getKnownSectorsOfFaction(int factionIndex)
function SectorView... getKnownSectorsWithFaction(int factionIndex)
function int, int getMemberLocation(int playerIndex)
function AllianceRank getMemberRank(int playerIndex)
function table<int, Member> getMembers()
function string... getNamesOfShipsInSector(int x, int y)
function string getNewMemberRank()
function int... getOnlineMembers()
function AllianceRank getRank(string name)
function table<int, string> getScripts()
function ShipAvailability getShipAvailability(string name)
function Box getShipBoundingBox(string name)
function bool getShipCanPassRifts(string name)
function CargoBay getShipCargo(string name)
function table<TradingGood, int> getShipCargos(string name)
function Crew getShipCrew(string name)
function bool getShipDestroyed(string name)
function float getShipHyperspaceReach(string name)
function string getShipIcon(string name)
function string... getShipNames()
function string getShipOrderInfo(string name)
function float getShipPayment(string name)
function float getShipPaymentTime(string name)
function BlockPlan getShipPlan(string name)
function Coordinates getShipPosition(string name)
function double getShipReconstructionValue(string name)
function string getShipStatus(string name)
function ShipInfoUpgrade... getShipSystems(string name)
function table<int, TurretDesign> getShipTurretDesigns(string name)
function int getShipType(string name)
function bool hasPrivilege(int playerIndex, int privilege)
function var hasScript(string name)
function var... invokeFunction()
function bool knowsSector(int x, int y)
function var moveRank(string name, string lowerName)
Returns
nothing
function bool ownsShip(string name)
function bool rankExists(string rank)
function var registerCallback(string callbackName, string functionName)
Register a callback in the player. The callback will be removed when the sector is changed or the receiver, if it's an entity, is destroyed. Double registration of callbacks doesn't work. When the same callback to the same callback of the same script instance is registered twice, it will still only be called once.
Parameters
functionName The name of the function that will be executed in the script when the callback happens
Returns
nothing
function var removeDestroyedShipInfo(string name)
Returns
nothing
function var removeKnownSector(int x, int y)
Returns
nothing
function var removeRank(string name)
Returns
nothing
function var removeRankPrivilege(string rankName, int privilege)
Returns
nothing
function var removeScript(var script)
Returns
nothing
function var resolveScriptPath(string path)
function Entity restoreCraft(string name, Matrix position, bool withMalus)
function var restoreTurrets(Entity scriptCraft)
Returns
nothing
function var sendCallback()
Returns
nothing
function var sendChatMessage(var sender, int messageType, string message, PluralForm... args)
Send a chat message to the player. Supports sending of format arguments so that the message can be translated on the client.
Parameters
messageType The type of chat message, 0 = Normal, 1 = Error, 2 = Warning, 3 = Info
message The message that will be sent
args The format arguments that will be sent
Returns
nothing
function var setMemberRank(int playerIndex, string rank)
Returns
nothing
function var setNewMemberRank(string rank)
Returns
nothing
function var setShipAvailability(string name, ShipAvailability availability)
Returns
nothing
function var setShipDestroyed(string name, bool value)
Returns
nothing
function var setShipIcon(string name, string icon)
Returns
nothing
function var setShipOrderInfo(string name, var value)
Returns
nothing
function var setShipReconstructionValue(string name, double value)
Returns
nothing
function var unregisterCallback(string , string )
Returns
nothing
function var updateKnownSector(SectorView view)
Returns
nothing
function var updateKnownSectorPreserveNote(SectorView view)
Returns
nothing
function var addPlanStyle(string name, PlanStyle style)
function bool, string, table<int, string> canPay()
Inherited from Faction [Server]
function bool, string, table<int, string> canPayMoney(int money)
Inherited from Faction [Server]
function bool, string, table<int, string> canPayResource(Material material, int amount)
Inherited from Faction [Server]
function var clearValues()
function Relation... getAllRelations()
Inherited from Faction [Server]
function int, int getHomeSectorCoordinates()
Inherited from Faction [Server]
function Inventory getInventory()
Inherited from Faction [Server]
function Language getLanguage()
Inherited from Faction [Server]
function PlanStyle getPlanStyle(string name)
Inherited from Faction [Server]
function string... getPlanStyleNames()
Inherited from Faction [Server]
function Relation getRelation(int otherFactionIndex)
Inherited from Faction [Server]
function int getRelations(int factionIndex)
Inherited from Faction [Server]
function int getRelationStatus(int factionIndex)
Inherited from Faction [Server]
function int... getResources()
Inherited from Faction [Server]
function float getTrait(string trait)
Retrieves a trait value associated with a key Inherited from Faction [Server]
Parameters
Returns
The trait value associated with the key
function table<string, float> getTraits()
Retrieves all key-value trait pairs of the faction Inherited from Faction [Server]
Returns
A table containing all custom key-value pairs
function var getValue(string key)
Retrieves a custom value saved in the entity with the given key Inherited from Faction [Server]
Parameters
Returns
The value if the key exists, otherwise nil
function table<string, var> getValues()
Retrieves all key-value pairs of custom values Inherited from Faction [Server]
Returns
A table containing all custom key-value pairs
function bool hasStaticRelationsToFaction(int factionIndex)
Inherited from Faction [Server]
function bool knowsFaction(int factionIndex)
Inherited from Faction [Server]
function var pay(string or Format [optional] description, int money, int... resources)
Makes the faction pay a certain amount of money and resources. If the faction can't pay, the respective money and resources will be set to 0. This function accepts an optional string for Format as first argument, as an economy notification describing the transaction that will be sent to the player, in case the faction is a player.
To ease handling of transaction descriptions, the format description (if set) will receive all the remaining arguments given to the pay() function as format arguments, in the same order as they are given to the function. Dots for easier reading will be inserted as well. Examples:
faction:pay("Paid %1% Credits and %2% iron.", 50000, 250)
-> "Paid 50.000 Credits and 250 iron."
faction:pay(Format("%1% paid %2% Credits and %3% iron.", "Excelsior"), 50, 25000)
-> "Excelsior paid 50 Credits and 25.000 iron."
Inherited from Faction [Server]
Parameters
money Money that will be removed from the faction
resources A list of resources, starting with iron, that will be removed from the faction
Returns
nothing
function var payResource(string or Format description, Material material, int amount)
Makes the faction pay a certain amount of resources. If the faction can't pay, the respective resource will be set to 0. This function accepts a string for Format as first argument, as an economy notification describing the transaction that will be sent to the player, in case the faction is a player. Inherited from Faction [Server]
Parameters
material The kind of material that will be removed from the faction
amount Amount that will be removed from the faction
Returns
nothing
function var payWithoutNotify(string or Format description, int money, int... args)
Similar behavior to pay(), except there will not be a notification popping up in case the faction is a player, and the description for the transaction in this function isn't optional. Inherited from Faction [Server]
Parameters
money Money that will be removed from the faction
args A list of resources, starting with iron, that will be removed from the faction
Returns
nothing
function var receive(string or Format [optional] description, int money, int... resources)
Makes the faction receive a certain amount of money and resources. This function accepts an optional string for Format as first argument, as an economy notification describing the transaction that will be sent to the player, in case the faction is a player.
To ease handling of transaction descriptions, the format description (if set) will receive all the remaining arguments given to the receive() function as format arguments, in the same order as they are given to the function. Dots for easier reading will be inserted as well. Examples:
faction:receive("Got %1% Credits and %2% iron.", 50000, 250)
-> "Got 50.000 Credits and 250 iron."
faction:receive(Format("%1% received %2% Credits and %3% iron.", "Excelsior"), 50, 25000)
-> "Excelsior received 50 Credits and 25.000 iron."
Inherited from Faction [Server]
Parameters
money Money that will be given to the faction
resources A list of resources, starting with iron, that will be given to the faction
Returns
nothing
function var receiveResource(string or Format description, Material material, int amount)
Makes the faction receive a certain amount of resources. This function accepts a string for Format as first argument, as an economy notification describing the transaction that will be sent to the player, in case the faction is a player. Inherited from Faction [Server]
Parameters
material The kind of material that will be given to the faction
amount Amount that will be given to the faction
Returns
nothing
function var receiveWithoutNotify(string or Format description, int money, int... args)
Similar behavior to receive(), except there will not be a notification popping up in case the faction is a player, and the description for the transaction in this function isn't optional. Inherited from Faction [Server]
Parameters
money Money that will be given to the faction
args A list of resources, starting with iron, that will be given to the faction
Returns
nothing
function var sendCallback()
function var sendChatMessage()
function var setHomeSectorCoordinates(int x, int y)
function var setLanguage(Language language)
function var setResources()
function var setStaticRelationsToFaction(int factionIndex, bool in)
function var setTrait(string trait, float value)
Sets a trait value associated with a key Inherited from Faction [Server]
Parameters
value The value of the trait, should be between -1 and 1
Returns
nothing
function var setValue(string key, var value)
Sets a custom value Inherited from Faction [Server]
Parameters
value The value to save. Must be bool, number, string or nil. If nil is given, the value will be deleted.
Callbacks Alliance [Client] Callbacks Alliance [Server] Callbacks Alliance [Server] Callbacks Entity Callbacks Galaxy Callbacks Player Callbacks Player [Client] Callbacks Sector Callbacks Server Callbacks
Command Entity FactionDatabase PlanGenerator Player Sector Server UsableInventoryItem
Boarding BspTree CargoBay CargoLoot ControlUnit CrewComponent DeletionTimer DirectFlightPhysics DockingClamps DockingParent DockingPositions Durability EnergySystem Engine FighterAI Hangar HyperspaceEngine InteractionText InventoryItemLoot Owner Physics Plan ReadOnlyBoarding ReadOnlyBspTree ReadOnlyCargoBay ReadOnlyControlUnit ReadOnlyCrew ReadOnlyDeletionTimer ReadOnlyEnergySystem ReadOnlyEngine ReadOnlyFighterAI ReadOnlyHangar ReadOnlyHyperspaceEngine ReadOnlyInteractionText ReadOnlyOwner ReadOnlyPhysics ReadOnlyPlan ReadOnlyShipAI ReadOnlyShipSystem ReadOnlyTorpedoAI [Server] [Client] [Server] [Client] ReadOnlyTorpedoAI [Server] [Client] [Server] [Client] ReadOnlyTorpedoLauncher ReadOnlyTurretBases ReadOnlyVelocity ReadOnlyWeapons ReadOnlyWormHole Shield ShipAI ShipSystem StructuralIntegrity SystemUpgradeLoot Thrusters Torpedo TorpedoAI TorpedoLauncher Turret TurretAI TurretBases Velocity Weapons WormHole
AllianceMember AllianceRank BlockPlan BlockPlanBlock BlockStatistics Box Captain Color ControlUnitSeat CraftDesign CraftStatsOverview Crew CrewMan CrewProfession DebugInfo dvec2 dvec3 dvec4 Entity EntityDescriptor FighterTemplate Format GameSettings Group HighResolutionTimer Inventory InventoryTurret ivec2 ivec3 ivec4 Language Mail Material Matrix ModManager NamedFormat PlanBspTree PlanetSpecifics PlanGenerationStage PlanPart PlanStyle PlayerId PluralForm Profiler QuadTree Random Rarity Ray ReadOnlyEntity Rect Relation Scenario SectorView Seed Sphere Squad SystemUpgradeTemplate Timer Tooltip TooltipLine TorpedoShaft TorpedoTemplate TradingGood TurretDesign TurretDesignPart TurretTemplate UsableInventoryItem Uuid VanillaInventoryItem vec2 vec3 vec4 Version Weapon
EntityIcon EntityTooltip PlanMesh ReadOnlyIcon ReadOnlyPlanMesh ReadOnlyScriptUI ReadOnlyTooltip ScriptUI
Achievements Alliance [Client] CameraKeyFrame CaptainSelectionItem Client ClientSettings ColorSelectionItem CraftDesignSelectionItem Faction [Client] Galaxy [Client] GalaxyMap GameInput GlowFX IconSelectionItem InputWindow InventoryReferenceSelectionItem InventorySelectionItem Keyboard LaserFX Mouse Music PixelIconSelectionItem Planet Player [Client] PlayerWindow RefractionFX Sector [Client] SelectionItem ShipDatabaseEntry [Client] SoundSource StrategyState TargetIndicator TooltipRenderer TurretDesignSelectionItem
AllianceEmblem AllianceTab ArrowLine Button [Client] [Client] Button [Client] [Client] CaptainIcon CaptainProfile CheckBox ComboBox ContextMenu CraftPortrait CrewBar Frame Hud InventorySelection Label Line ListBox ListBoxEx MapArrowLine MapIcon MultiLineTextBox NumbersBar Picture PlanDisplayer ProgressBar SavedDesignsSelection ScrollFrame Selection ShipWindow Slider StatisticsBar Tab TabbedWindow TextBox TextField TooltipDisplayer Tree UIArbitraryHorizontalSplitter UIArbitraryVerticalSplitter UIContainer UIElement UIGridSplitter UIHorizontalLister UIHorizontalMultiSplitter UIHorizontalSplitter UIOrganizer UIRect UIRenderer UIVerticalLister UIVerticalMultiSplitter UIVerticalSplitter ValueComboBox Window
EntityTransferrer FighterController Loot ReadOnlyEntityTransferrer ReadOnlyFighterController ReadOnlyLoot ReadOnlyTurretController ReadOnlyWreckageCreator TurretController WreckageCreator
Alliance [Server] Faction [Server] Galaxy [Server] Player [Server] ReadOnlySector Sector [Server] Server ShipDatabaseEntry [Server]
AIState AlliancePrivilege BeamShape BlockShading BlockStructure BlockType BlockType2 BoxType BuildError CaptainGenderId ChatChannel ChatMessageType ComponentType ControlAction ControlActionBit ControlStyle CoolingType CraftStatsOverviewStat CrewProfessionType CrewRank DamageSource DamageType DeletionType Difficulty EntityArrivalType EntityType FighterOrders FighterStartError FighterType FontType ImpactParticles InventoryItemType JumpError KeyboardKey ListBoxEntryType MalusReason MaterialType MoonType MouseButton PlanetType PlayerStateType ProjectileShape RarityType RelationStatus SavedDesignType ScenarioType SectorChangeType ShipAvailability SoundType StatsBonuses TargetIndicatorVisuals TransformationFeature TurretAutoFireMode TurretSlotType WeaponAppearance WeaponCategory
This is the official documentation for the scripting API of Avorion. This documentation is automatically generated and not necessarily complete. Depending on the context in which functions exist, some documentation such as descriptions, return values or variable names or types may be missing.
Work in Progress. Documentation of Avorion Version: 2.5.7 c8e4beec84f7